// import store from '@/store';


// import wxloginAPI from '@/api/wxlogin';
// import payAPI from '@/api/pay.js';

// #ifdef APP-PLUS
// APP分享
export const appShare = function(data, callbcak) {
	console.log(data);
	let miniProgramPath = data.miniProgramUrl;
	if (data.productID) {
		miniProgramPath = miniProgramPath + '?id=' + data.productID + '&shareToken=' + uni.getStorageInfoSync(
			'AUTH_TOKEN')
	} else {
		miniProgramPath = miniProgramPath + '?shareToken=' + uni.getStorageInfoSync('AUTH_TOKEN');
	}

	uni.share({
		provider: "weixin",
		scene: data.type == 'wechat' ? 'WXSceneSession' : 'WXSceneTimeline',
		title: data.title,
		type: 5,
		imageUrl: data.imageUrl,
		miniProgram: {
			id: 'gh_5f77207f4349',
			path: miniProgramPath,
			type: 0,
			webUrl: 'http://uniapp.dcloud.io'
		},
		complete(res) {
			console.log("complete:" + JSON.stringify(res));
		},
		success: function(res) {
			console.log("success:" + JSON.stringify(res));
		},
		fail: function(err) {
			console.log("fail:" + JSON.stringify(err));
			let myerr = err;
			if (myerr.errMsg.search("微信未安装") != -1) {
				uni.showToast({
					title: '微信未安装',
					icon: 'none',
					duration: 2000
				});
			} else {
				uni.showToast({
					title: myerr.errMsg,
					icon: 'none',
					duration: 2000
				});
			}
		}
	});
};
// #endif